package main

import (
	"fmt"
	"math"
)

//矩形
type Rectangle struct {
	width, height float64
}

//求矩形面积
func (rect *Rectangle) Area() float64 {
	return rect.width * rect.height
}
func (rect Rectangle) String() string {
	return fmt.Sprintf("Rect:(w:%f h:%f)\n", rect.width, rect.height)
}

//圆形
type Circle struct {
	radius float64
}

//求圆面积
func (c *Circle) Area() float64 {
	return c.radius * c.radius * math.Pi
}

//面积的接口
type Shape interface {
	Area() float64
}

func main() {
	rect := Rectangle{100, 80}
	fmt.Println(rect) //会查找和掉用Stirng方法
}
